<template>
  <div o-Container>
    <div class="content_left_box">
      <div class="top_box">
        <div class="search_box">
          <img src="/static/skin/herodoo/main/platform/home/img/search.png" alt="">
          <input v-model="searchValue" type="text" placeholder="请输入搜索内容" @keydown.enter="searchEnterKeyPress"
          @blur="searchEnterKeyPress">
          <!-- <img src="/static/skin/herodoo/main/platform/home/img/shaixuan.png" alt="" @click="openScreen()"> -->
        </div>
        <!-- <div class="button_box">
          <button>导出订单</button>
        </div> -->
      </div>
    </div>
    <o-list v-bind:source="list.contract" v-bind="{exported: output  }">
      <template slot="config" slot-scope="scope">
        <div class="img_box">
          <img @click="showLookDiaolog(scope)" src="/static/skin/default/MCS/AIGC/Inventory/images/chakan.png" alt="">
        </div>
      </template>
    </o-list>
    <SalesOrderMsg ref="SalesOrderMsg" :messageList="messageList"></SalesOrderMsg>
    <screenRights ref="screenRights" @searchFun="search"></screenRights>
    <!-- <AfterSaleOrderMsg ref="AfterSaleOrderMsg" :messageList="messageList"></AfterSaleOrderMsg> -->
  </div>
</template>

<script>
import SalesOrderMsg from '../Components/SalesOrderMsg.vue'
import screenRights from "../Components/screenRights.vue"
// import AfterSaleOrderMsg from '../Components/AfterSaleOrderMsg.vue'
export default {
  components: {
    SalesOrderMsg,
    screenRights
    // AfterSaleOrderMsg
  },
  name: "mms_platform_company_list", /* 这个name暂时不知道用啥用，根据官方文档说的是方便排错的 */
  data() {
    return {
      octopus: this.$parent.octopus,
      list: {
        contract: {
          data: {
            id: 1255, // 菜单表的八爪鱼ID
            cellData: [
              { name: "Code",width:200 },	// 订单编号
              { name: "Name" ,width:400},	// 权益名称
              { name: "MerchantID" ,width:200,show:false},	// 买家
              { name: "Quantity" },	// 购买数量
              { name: "TotalPrice" },	// 下单金额（元）
              { name: "PurchaseCompanyName" ,width:200},	// 卖家
              { name: "STATUS" },	// 核销状态
              { name: "CreateTime" ,width:150},	// 下单时间
              { name: "PlatformID",show:false },	// 购买渠道
              { name: "SalePrice" ,show:false},	// 市场价格
              { name: "ServiceCompanyName",show:false },	// 服务方
              {name:"CostPrice",show:false},
              {name: "TypeID", show: false},	// TypeID
              {name: "ID", show: false},	// TypeID
              { name: "EquityID", show: false },	// 权益ID
            ],
            paramData: {}
          },
          configWidth: 35,
          showNumber: true,
        },
      },
      repetition: true,
      messageList: {},
      messageListAdd: {},
      rightList: []
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      const data = this.list.contract.data
      let company = this.octopus.passport.authorization.company
      data.paramData.CompanyID = company == 1 ? 'NULL' : company
    },
    showLookDiaolog(row) {
      this.messageList = row.data.row
      this.$nextTick(() => {
        this.$refs.SalesOrderMsg.pageShow = 1;
        this.$refs.SalesOrderMsg.drawerOp()
      })
    },
    output: function (data) {
      this.octopus.tips.success("下载完成。");
    },
    search: function (cell) {
    },
    save: function (data) {// 保存
      this.octopus.tips.success(data);
      // 刷新list
      this.list.contract.control.load();
      this.back();
    },
    back: function () {
      this.panel.visible = false;
    },
    del: function (row) {
      let o = this
      // alert("del key: " + JSON.stringify(row));
      this.$confirm('此操作将永久删除该项, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.octopus.request.api.post("/Octopus/Engine/Item", {
          id: 1188, // 菜单表的八爪鱼ID
          type: "DELETE",
          value: row.ID,
          cellData: [
            { name: "ID", defaultValue: row.ID },
          ],
        },
          // 处理回调事件，通过分析data.status.code的状态来实现。
          function (data) {
            if (data.status.code === 200) {
              o.list.contract.control.load();
            } else {
              o.octopus.tips.error(data);
            }
          }
        );
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    openScreen() {
      this.$refs.screenRights.drawerOp();
    },
    searchEnterKeyPress(e) {
      this.list.contract.data.cellData[0] = { name: "Code", width: 200 ,filterKey: 'like', filterValue: this.searchValue}
      this.list.contract.control.load()
    }
  },
  props: ["oData"]
}
</script>
<style scoped>
@import url("../../../../../../static/skin/default/MMS/AIGC/css/base.css");
.el-message-box {
  background-color: #fff !important;
}

.img_box {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.img_box img {
  width: 25px;
  cursor: pointer;
}
>>> .Operation {
  position: absolute;
  top: 1.5rem;
  left: 36rem;
}
>>> .Content {
  height: 84vh!important;
}
</style>
